package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<Brand> {

    /**
    * @Date: 16:31 2020/3/27
    * @Param: [cateName]
    * @return: java.util.List<com.changgou.goods.pojo.Brand>
    * @Description: 根据商品分类名称查询品牌列表
    **/

    //@Param 如果#{name}中的参数与传入参数不一致则需要借助于@Param注解做映射，如果一致则不需要 例如： #{cateName}
    @Select("SELECT * FROM tb_brand a JOIN tb_category_brand b ON a.id = b.brand_id JOIN tb_category c ON b.category_id = c.id WHERE c.name=#{name}")
    List<Brand> findByCateName(@Param("name") String cateName);
}
